#include <REGX52.H>
#include "Timer3.h"
#include "Nixie.h"
#include "Key.h"
#include "Delay.h"
#include "IR.h"
sbit Motor=P1^0;
unsigned char Counter,Compare;
//unsigned char Motor;
void main()
{
	
	unsigned char Anjian=0;
	unsigned char Biaozhi=0;
	unsigned char Chongfa=0;
	unsigned char MIngling=0;
	Timer3_Init();
	IR_INit();
	while(1)
	{
		Anjian=IR_GetCommand();
		if(Anjian==IR_1)
		{
			Compare=50;
			Nixie(1,1);
		}
		if(Anjian==IR_2)
		{
			Compare=75;
			Nixie(1,2);
		}
		if(Anjian==IR_3)
		{
			Compare=100;
			Nixie(1,3);
		}
		if(Anjian==IR_POWER)
		{
			Compare=0;
			Nixie(1,0);
		}
	}
}

void Timer3_Routine() interrupt 3
{
	TL1 = 0x9C;		//设置定时初值
	TH1 = 0xFF;		//设置定时初值
	Counter++;
	Counter%=100;	//计数值变化范围限制在0~99
	if(Counter<Compare)	//计数值小于比较值
	{
		Motor=1;		//输出1
	}
	else				//计数值大于比较值
	{
		Motor=0;		//输出0
	}
}